\(\int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx\) [9]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 141 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-2 a^2 (A-i B) x+\frac {2 a^2 (i A+B) \log (\cos (c+d x))}{d}+\frac {2 a^2 (A-i B) \tan (c+d x)}{d}+\frac {a^2 (i A+B) \tan ^2(c+d x)}{d}-\frac {a^2 (4 A-5 i B) \tan ^3(c+d x)}{12 d}+\frac {i B \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{4 d} \]

[Out]

-2*a^2*(A-I*B)*x+2*a^2*(I*A+B)*ln(cos(d*x+c))/d+2*a^2*(A-I*B)*tan(d*x+c)/d+a^2*(I*A+B)*tan(d*x+c)^2/d-1/12*a^2
*(4*A-5*I*B)*tan(d*x+c)^3/d+1/4*I*B*tan(d*x+c)^3*(a^2+I*a^2*tan(d*x+c))/d

Rubi [A] (verified)

Time = 0.40 (sec) , antiderivative size = 141, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.147, Rules used = {3675, 3673, 3609, 3606, 3556} \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {a^2 (4 A-5 i B) \tan ^3(c+d x)}{12 d}+\frac {a^2 (B+i A) \tan ^2(c+d x)}{d}+\frac {2 a^2 (A-i B) \tan (c+d x)}{d}+\frac {2 a^2 (B+i A) \log (\cos (c+d x))}{d}-2 a^2 x (A-i B)+\frac {i B \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{4 d} \]

[In]

Int[Tan[c + d*x]^2*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

-2*a^2*(A - I*B)*x + (2*a^2*(I*A + B)*Log[Cos[c + d*x]])/d + (2*a^2*(A - I*B)*Tan[c + d*x])/d + (a^2*(I*A + B)
*Tan[c + d*x]^2)/d - (a^2*(4*A - (5*I)*B)*Tan[c + d*x]^3)/(12*d) + ((I/4)*B*Tan[c + d*x]^3*(a^2 + I*a^2*Tan[c
+ d*x]))/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3606

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[b*d*(Tan[e + f*x]/f), x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3609

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*
((a + b*Tan[e + f*x])^m/(f*m)), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3673

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(
e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[B*d*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1))), x] + Int[(a + b*Tan[e
 + f*x])^m*Simp[A*c - B*d + (B*c + A*d)*Tan[e + f*x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, m}, x] && NeQ[b
*c - a*d, 0] &&  !LeQ[m, -1]

Rule 3675

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*B*(a + b*Tan[e + f*x])^(m - 1)*((c + d*Tan[e + f*x])^(n + 1)/(d*f*
(m + n))), x] + Dist[1/(d*(m + n)), Int[(a + b*Tan[e + f*x])^(m - 1)*(c + d*Tan[e + f*x])^n*Simp[a*A*d*(m + n)
 + B*(a*c*(m - 1) - b*d*(n + 1)) - (B*(b*c - a*d)*(m - 1) - d*(A*b + a*B)*(m + n))*Tan[e + f*x], x], x], x] /;
 FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && GtQ[m, 1] &&  !LtQ[n, -1]

Rubi steps \begin{align*} \text {integral}& = \frac {i B \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{4 d}+\frac {1}{4} \int \tan ^2(c+d x) (a+i a \tan (c+d x)) (a (4 A-3 i B)+a (4 i A+5 B) \tan (c+d x)) \, dx \\ & = -\frac {a^2 (4 A-5 i B) \tan ^3(c+d x)}{12 d}+\frac {i B \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{4 d}+\frac {1}{4} \int \tan ^2(c+d x) \left (8 a^2 (A-i B)+8 a^2 (i A+B) \tan (c+d x)\right ) \, dx \\ & = \frac {a^2 (i A+B) \tan ^2(c+d x)}{d}-\frac {a^2 (4 A-5 i B) \tan ^3(c+d x)}{12 d}+\frac {i B \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{4 d}+\frac {1}{4} \int \tan (c+d x) \left (-8 a^2 (i A+B)+8 a^2 (A-i B) \tan (c+d x)\right ) \, dx \\ & = -2 a^2 (A-i B) x+\frac {2 a^2 (A-i B) \tan (c+d x)}{d}+\frac {a^2 (i A+B) \tan ^2(c+d x)}{d}-\frac {a^2 (4 A-5 i B) \tan ^3(c+d x)}{12 d}+\frac {i B \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{4 d}-\left (2 a^2 (i A+B)\right ) \int \tan (c+d x) \, dx \\ & = -2 a^2 (A-i B) x+\frac {2 a^2 (i A+B) \log (\cos (c+d x))}{d}+\frac {2 a^2 (A-i B) \tan (c+d x)}{d}+\frac {a^2 (i A+B) \tan ^2(c+d x)}{d}-\frac {a^2 (4 A-5 i B) \tan ^3(c+d x)}{12 d}+\frac {i B \tan ^3(c+d x) \left (a^2+i a^2 \tan (c+d x)\right )}{4 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.36 (sec) , antiderivative size = 101, normalized size of antiderivative = 0.72 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {a^2 \left (-4 i A-5 B-24 i (A-i B) \log (i+\tan (c+d x))+24 (A-i B) \tan (c+d x)+12 (i A+B) \tan ^2(c+d x)-4 (A-2 i B) \tan ^3(c+d x)-3 B \tan ^4(c+d x)\right )}{12 d} \]

[In]

Integrate[Tan[c + d*x]^2*(a + I*a*Tan[c + d*x])^2*(A + B*Tan[c + d*x]),x]

[Out]

(a^2*((-4*I)*A - 5*B - (24*I)*(A - I*B)*Log[I + Tan[c + d*x]] + 24*(A - I*B)*Tan[c + d*x] + 12*(I*A + B)*Tan[c
 + d*x]^2 - 4*(A - (2*I)*B)*Tan[c + d*x]^3 - 3*B*Tan[c + d*x]^4))/(12*d)

Maple [A] (verified)

Time = 0.09 (sec) , antiderivative size = 121, normalized size of antiderivative = 0.86

method result size
derivativedivides \(\frac {a^{2} \left (\frac {2 i B \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {B \left (\tan ^{4}\left (d x +c \right )\right )}{4}+i A \left (\tan ^{2}\left (d x +c \right )\right )-\frac {A \left (\tan ^{3}\left (d x +c \right )\right )}{3}-2 i B \tan \left (d x +c \right )+B \left (\tan ^{2}\left (d x +c \right )\right )+2 A \tan \left (d x +c \right )+\frac {\left (-2 i A -2 B \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (2 i B -2 A \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(121\)
default \(\frac {a^{2} \left (\frac {2 i B \left (\tan ^{3}\left (d x +c \right )\right )}{3}-\frac {B \left (\tan ^{4}\left (d x +c \right )\right )}{4}+i A \left (\tan ^{2}\left (d x +c \right )\right )-\frac {A \left (\tan ^{3}\left (d x +c \right )\right )}{3}-2 i B \tan \left (d x +c \right )+B \left (\tan ^{2}\left (d x +c \right )\right )+2 A \tan \left (d x +c \right )+\frac {\left (-2 i A -2 B \right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+\left (2 i B -2 A \right ) \arctan \left (\tan \left (d x +c \right )\right )\right )}{d}\) \(121\)
norman \(\left (2 i B \,a^{2}-2 A \,a^{2}\right ) x +\frac {\left (i A \,a^{2}+B \,a^{2}\right ) \left (\tan ^{2}\left (d x +c \right )\right )}{d}-\frac {\left (-2 i B \,a^{2}+A \,a^{2}\right ) \left (\tan ^{3}\left (d x +c \right )\right )}{3 d}+\frac {2 \left (-i B \,a^{2}+A \,a^{2}\right ) \tan \left (d x +c \right )}{d}-\frac {B \,a^{2} \left (\tan ^{4}\left (d x +c \right )\right )}{4 d}-\frac {\left (i A \,a^{2}+B \,a^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) \(139\)
parts \(\frac {\left (2 i A \,a^{2}+B \,a^{2}\right ) \left (\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}+\frac {\left (2 i B \,a^{2}-A \,a^{2}\right ) \left (\frac {\left (\tan ^{3}\left (d x +c \right )\right )}{3}-\tan \left (d x +c \right )+\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}+\frac {A \,a^{2} \left (\tan \left (d x +c \right )-\arctan \left (\tan \left (d x +c \right )\right )\right )}{d}-\frac {B \,a^{2} \left (\frac {\left (\tan ^{4}\left (d x +c \right )\right )}{4}-\frac {\left (\tan ^{2}\left (d x +c \right )\right )}{2}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}\right )}{d}\) \(154\)
parallelrisch \(-\frac {-8 i B \left (\tan ^{3}\left (d x +c \right )\right ) a^{2}+3 B \,a^{2} \left (\tan ^{4}\left (d x +c \right )\right )-12 i A \left (\tan ^{2}\left (d x +c \right )\right ) a^{2}+4 A \left (\tan ^{3}\left (d x +c \right )\right ) a^{2}-24 i B x \,a^{2} d +12 i A \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2}+24 A x \,a^{2} d +24 i B \tan \left (d x +c \right ) a^{2}-12 B \left (\tan ^{2}\left (d x +c \right )\right ) a^{2}-24 A \tan \left (d x +c \right ) a^{2}+12 B \ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a^{2}}{12 d}\) \(156\)
risch \(-\frac {4 i a^{2} B c}{d}+\frac {4 a^{2} A c}{d}+\frac {2 a^{2} \left (15 i A \,{\mathrm e}^{6 i \left (d x +c \right )}+21 B \,{\mathrm e}^{6 i \left (d x +c \right )}+33 i A \,{\mathrm e}^{4 i \left (d x +c \right )}+36 B \,{\mathrm e}^{4 i \left (d x +c \right )}+25 i A \,{\mathrm e}^{2 i \left (d x +c \right )}+29 B \,{\mathrm e}^{2 i \left (d x +c \right )}+7 i A +8 B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{4}}+\frac {2 a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) B}{d}+\frac {2 i a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) A}{d}\) \(170\)

[In]

int(tan(d*x+c)^2*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*a^2*(2/3*I*B*tan(d*x+c)^3-1/4*B*tan(d*x+c)^4+I*A*tan(d*x+c)^2-1/3*A*tan(d*x+c)^3-2*I*B*tan(d*x+c)+B*tan(d*
x+c)^2+2*A*tan(d*x+c)+1/2*(-2*B-2*I*A)*ln(1+tan(d*x+c)^2)+(-2*A+2*I*B)*arctan(tan(d*x+c)))

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 236, normalized size of antiderivative = 1.67 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left (3 \, {\left (-5 i \, A - 7 \, B\right )} a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, {\left (-11 i \, A - 12 \, B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-25 i \, A - 29 \, B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-7 i \, A - 8 \, B\right )} a^{2} + 3 \, {\left ({\left (-i \, A - B\right )} a^{2} e^{\left (8 i \, d x + 8 i \, c\right )} + 4 \, {\left (-i \, A - B\right )} a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, {\left (-i \, A - B\right )} a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} + 4 \, {\left (-i \, A - B\right )} a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-i \, A - B\right )} a^{2}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right )\right )}}{3 \, {\left (d e^{\left (8 i \, d x + 8 i \, c\right )} + 4 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 4 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]

[In]

integrate(tan(d*x+c)^2*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

-2/3*(3*(-5*I*A - 7*B)*a^2*e^(6*I*d*x + 6*I*c) + 3*(-11*I*A - 12*B)*a^2*e^(4*I*d*x + 4*I*c) + (-25*I*A - 29*B)
*a^2*e^(2*I*d*x + 2*I*c) + (-7*I*A - 8*B)*a^2 + 3*((-I*A - B)*a^2*e^(8*I*d*x + 8*I*c) + 4*(-I*A - B)*a^2*e^(6*
I*d*x + 6*I*c) + 6*(-I*A - B)*a^2*e^(4*I*d*x + 4*I*c) + 4*(-I*A - B)*a^2*e^(2*I*d*x + 2*I*c) + (-I*A - B)*a^2)
*log(e^(2*I*d*x + 2*I*c) + 1))/(d*e^(8*I*d*x + 8*I*c) + 4*d*e^(6*I*d*x + 6*I*c) + 6*d*e^(4*I*d*x + 4*I*c) + 4*
d*e^(2*I*d*x + 2*I*c) + d)

Sympy [A] (verification not implemented)

Time = 0.46 (sec) , antiderivative size = 236, normalized size of antiderivative = 1.67 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {2 i a^{2} \left (A - i B\right ) \log {\left (e^{2 i d x} + e^{- 2 i c} \right )}}{d} + \frac {14 i A a^{2} + 16 B a^{2} + \left (50 i A a^{2} e^{2 i c} + 58 B a^{2} e^{2 i c}\right ) e^{2 i d x} + \left (66 i A a^{2} e^{4 i c} + 72 B a^{2} e^{4 i c}\right ) e^{4 i d x} + \left (30 i A a^{2} e^{6 i c} + 42 B a^{2} e^{6 i c}\right ) e^{6 i d x}}{3 d e^{8 i c} e^{8 i d x} + 12 d e^{6 i c} e^{6 i d x} + 18 d e^{4 i c} e^{4 i d x} + 12 d e^{2 i c} e^{2 i d x} + 3 d} \]

[In]

integrate(tan(d*x+c)**2*(a+I*a*tan(d*x+c))**2*(A+B*tan(d*x+c)),x)

[Out]

2*I*a**2*(A - I*B)*log(exp(2*I*d*x) + exp(-2*I*c))/d + (14*I*A*a**2 + 16*B*a**2 + (50*I*A*a**2*exp(2*I*c) + 58
*B*a**2*exp(2*I*c))*exp(2*I*d*x) + (66*I*A*a**2*exp(4*I*c) + 72*B*a**2*exp(4*I*c))*exp(4*I*d*x) + (30*I*A*a**2
*exp(6*I*c) + 42*B*a**2*exp(6*I*c))*exp(6*I*d*x))/(3*d*exp(8*I*c)*exp(8*I*d*x) + 12*d*exp(6*I*c)*exp(6*I*d*x)
+ 18*d*exp(4*I*c)*exp(4*I*d*x) + 12*d*exp(2*I*c)*exp(2*I*d*x) + 3*d)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 112, normalized size of antiderivative = 0.79 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {3 \, B a^{2} \tan \left (d x + c\right )^{4} + 4 \, {\left (A - 2 i \, B\right )} a^{2} \tan \left (d x + c\right )^{3} + 12 \, {\left (-i \, A - B\right )} a^{2} \tan \left (d x + c\right )^{2} + 24 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{2} - 12 \, {\left (-i \, A - B\right )} a^{2} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 24 \, {\left (A - i \, B\right )} a^{2} \tan \left (d x + c\right )}{12 \, d} \]

[In]

integrate(tan(d*x+c)^2*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

-1/12*(3*B*a^2*tan(d*x + c)^4 + 4*(A - 2*I*B)*a^2*tan(d*x + c)^3 + 12*(-I*A - B)*a^2*tan(d*x + c)^2 + 24*(d*x
+ c)*(A - I*B)*a^2 - 12*(-I*A - B)*a^2*log(tan(d*x + c)^2 + 1) - 24*(A - I*B)*a^2*tan(d*x + c))/d

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 408 vs. \(2 (123) = 246\).

Time = 0.59 (sec) , antiderivative size = 408, normalized size of antiderivative = 2.89 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left (-3 i \, A a^{2} e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 3 \, B a^{2} e^{\left (8 i \, d x + 8 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 12 i \, A a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 12 \, B a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 18 i \, A a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 18 \, B a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 12 i \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 12 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 15 i \, A a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} - 21 \, B a^{2} e^{\left (6 i \, d x + 6 i \, c\right )} - 33 i \, A a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} - 36 \, B a^{2} e^{\left (4 i \, d x + 4 i \, c\right )} - 25 i \, A a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - 29 \, B a^{2} e^{\left (2 i \, d x + 2 i \, c\right )} - 3 i \, A a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 3 \, B a^{2} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) - 7 i \, A a^{2} - 8 \, B a^{2}\right )}}{3 \, {\left (d e^{\left (8 i \, d x + 8 i \, c\right )} + 4 \, d e^{\left (6 i \, d x + 6 i \, c\right )} + 6 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 4 \, d e^{\left (2 i \, d x + 2 i \, c\right )} + d\right )}} \]

[In]

integrate(tan(d*x+c)^2*(a+I*a*tan(d*x+c))^2*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

-2/3*(-3*I*A*a^2*e^(8*I*d*x + 8*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - 3*B*a^2*e^(8*I*d*x + 8*I*c)*log(e^(2*I*d*x
 + 2*I*c) + 1) - 12*I*A*a^2*e^(6*I*d*x + 6*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - 12*B*a^2*e^(6*I*d*x + 6*I*c)*lo
g(e^(2*I*d*x + 2*I*c) + 1) - 18*I*A*a^2*e^(4*I*d*x + 4*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - 18*B*a^2*e^(4*I*d*x
 + 4*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - 12*I*A*a^2*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - 12*B*a^
2*e^(2*I*d*x + 2*I*c)*log(e^(2*I*d*x + 2*I*c) + 1) - 15*I*A*a^2*e^(6*I*d*x + 6*I*c) - 21*B*a^2*e^(6*I*d*x + 6*
I*c) - 33*I*A*a^2*e^(4*I*d*x + 4*I*c) - 36*B*a^2*e^(4*I*d*x + 4*I*c) - 25*I*A*a^2*e^(2*I*d*x + 2*I*c) - 29*B*a
^2*e^(2*I*d*x + 2*I*c) - 3*I*A*a^2*log(e^(2*I*d*x + 2*I*c) + 1) - 3*B*a^2*log(e^(2*I*d*x + 2*I*c) + 1) - 7*I*A
*a^2 - 8*B*a^2)/(d*e^(8*I*d*x + 8*I*c) + 4*d*e^(6*I*d*x + 6*I*c) + 6*d*e^(4*I*d*x + 4*I*c) + 4*d*e^(2*I*d*x +
2*I*c) + d)

Mupad [B] (verification not implemented)

Time = 7.25 (sec) , antiderivative size = 153, normalized size of antiderivative = 1.09 \[ \int \tan ^2(c+d x) (a+i a \tan (c+d x))^2 (A+B \tan (c+d x)) \, dx=\frac {{\mathrm {tan}\left (c+d\,x\right )}^3\,\left (\frac {a^2\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{3}+\frac {B\,a^2\,1{}\mathrm {i}}{3}\right )}{d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-A\,a^2+a^2\,\left (B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}+B\,a^2\,1{}\mathrm {i}\right )}{d}+\frac {{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (\frac {a^2\,\left (B+A\,1{}\mathrm {i}\right )}{2}+\frac {B\,a^2}{2}+\frac {A\,a^2\,1{}\mathrm {i}}{2}\right )}{d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (2\,B\,a^2+A\,a^2\,2{}\mathrm {i}\right )}{d}-\frac {B\,a^2\,{\mathrm {tan}\left (c+d\,x\right )}^4}{4\,d} \]

[In]

int(tan(c + d*x)^2*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^2,x)

[Out]

(tan(c + d*x)^3*((a^2*(A*1i + B)*1i)/3 + (B*a^2*1i)/3))/d - (tan(c + d*x)*(a^2*(A*1i + B)*1i - A*a^2 + B*a^2*1
i))/d + (tan(c + d*x)^2*((A*a^2*1i)/2 + (a^2*(A*1i + B))/2 + (B*a^2)/2))/d - (log(tan(c + d*x) + 1i)*(A*a^2*2i
 + 2*B*a^2))/d - (B*a^2*tan(c + d*x)^4)/(4*d)